
#if !defined __RT_PAIRIPPORT_H__
#define __RT_PAIRIPPORT_H__

#include "RtDefines.h"
#include "RtInetAddr.h"

class CRtPairIpPort
{
public:
	CRtPairIpPort(const CRtInetAddr& addr)
		: m_ip(addr.GetIpAddrIn4Bytes())
		, m_port(addr.GetPort())
	{}

	CRtPairIpPort& operator = (const CRtInetAddr& addr)
	{
		m_ip = addr.GetIpAddrIn4Bytes();
		m_port = addr.GetPort();
		return *this;
	}

	DWORD GetHashValue() const 
	{
		return m_ip ^ (m_port+(((DWORD)m_port)<<16));
	}

	bool operator == (const CRtPairIpPort& rhs) const 
	{
		return m_ip == rhs.m_ip && m_port == rhs.m_port;
	}

	DWORD m_ip;
	WORD m_port;
};

#endif	//__RT_PAIRIPPORT_H__

